﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Areas/SystemManage/Views/Shared/_Form.cshtml";
}
<script>
    var keyValue = $.request("keyValue");
    //if (keyValue.length > 0) {
    //    $("#ConfigCode").prop("disabled", "disabled");
    //}
    $(function () {
        $("#Type").bindSelect()
        if (!!keyValue) {
            $.ajax({
                url: "/SystemManage/SysConfiguration/GetFormJson",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                }
            });
        }
    });
    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        var ConfigName = $("#ConfigName").val();
        var ConfigCode = $("#ConfigCode").val();
        var ConfigValue = $("#ConfigValue").val();
        if (ConfigName.length == 0) {
            $.modalMsg("配置名称不能为空");
            return false;
        }
        if (ConfigCode.length == 0) {
            $.modalMsg("配置编码不能为空");
            return false;
        }
        if (ConfigValue.length == 0) {
            $.modalMsg("配置值不能为空");
            return false;
        }
        $.submitForm({
            url: "/SystemManage/SysConfiguration/SubmitForm?keyValue=" + keyValue,
            param: $("#form1").formSerialize(),
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
</script>

<form id="form1">
    <div style="margin-bottom: 0px; border-radius: 0px;" class="alert alert-warning alert-dismissable">
        <strong>注意：</strong>&nbsp;配置内容请认真填写
    </div>
    <div style="padding-top: 20px; margin-right: 20px;">
        <table class="form">
            <tr>
                <th class="formTitle">配置名称</th>
                <td class="formValue">
                    <input id="ConfigName" name="ConfigName" type="text" class="form-control" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">配置编码</th>
                <td class="formValue">
                    <input id="ConfigCode" name="ConfigCode" type="text" class="form-control" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">配置值</th>
                <td class="formValue">
                    <input id="ConfigValue" name="ConfigValue" type="text" class="form-control" />
                </td>
            </tr>
            <tr>
                <th class="formTitle" style="height: 35px;">选项</th>
                <td class="formValue" style="padding-top: 1px;">
                    <div class="ckbox">
                        <input id="EnabledMark" name="EnabledMark" type="checkbox" checked="checked"><label for="EnabledMark">有效</label>
                    </div>
                </td>
            </tr>
            <tr>
                <th class="formTitle" valign="top" style="padding-top: 11px;">
                    备注
                </th>
                <td class="formValue">
                    <textarea id="Description" name="Description" class="form-control" style="height: 60px;"></textarea>
                </td>
            </tr>
        </table>
    </div>
</form>
